<template>
  <div class="UnauthorizedTest">
    <t-button @click="unauthorizedTest">未授权请求测试</t-button>
  </div>
</template>

<script>
import { http } from "@gonsin/gview";
import { MessagePlugin } from "tdesign-vue";
import router from "../router";

export default {
  name: "TestLicense",
  methods: {
    unauthorizedTest() {
      http.get("/license").then((res) => {
        if (res.state == "-409") {
          MessagePlugin.warning("未授权！");
          router.push({
            name: "license",
            query: {
              device: res.data.device,
              uuid: res.data.uuid,
            },
          });
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.UnauthorizedTest {
  width: 100vw;
  height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
